package com.diabeco.model.measures;

public enum GlycemiaUnit {
	MGDL(1), MMOLL(2);

	private int value;

	GlycemiaUnit(int value) {
		this.value = value;
	}

	public int getValue() {
		return value;
	}

	public String getName() {
		switch (value) {
		case 1:
			return "mg/dl";
		case 2:
			return "mmoll";
		}
		return "UNIT NOT SET";
	}

	public static GlycemiaUnit getInstance(int value) {
		switch (value) {
		case 1:
			return GlycemiaUnit.MGDL;
		case 2:
			return GlycemiaUnit.MMOLL;
		default:
			throw new RuntimeException("Cannot instantiate enum. Invalid GlycemiaUnit value.");
		}
	}
}
